﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="DueReport.aspx.vb" Inherits="DueReport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Title" runat="Server">Χρεωστούμενες</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" Runat="Server">
    <br />
    <asp:GridView ID="GridView1" runat="server" DataSourceID="sqldsDueReport" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
        GridLines="None" PageSize="15">
        <PagerSettings Mode="NumericFirstLast" Position="TopAndBottom" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <Columns>
            <asp:ButtonField ButtonType="Image" CommandName="Pithiki" 
                ImageUrl="~/img/tools.gif" Text="Edit" />
            <asp:BoundField DataField="id_Stratefsimos" HeaderText="Α/Α" 
                InsertVisible="False" SortExpression="id_Stratefsimos" />
            <asp:BoundField DataField="Eponimo" HeaderText="Επώνυμο" 
                SortExpression="Eponimo" />
            <asp:BoundField DataField="Onoma" HeaderText="Όνομα" SortExpression="Onoma" />
            <asp:BoundField DataField="Moira" HeaderText="Μοίρα" SortExpression="Moira" />
            <asp:BoundField DataField="Typos" HeaderText="Τύπος" SortExpression="Typos" />
            <asp:BoundField DataField="Provlepomenes" HeaderText="Προβλεπόμενες" 
                SortExpression="Provlepomenes" />
            <asp:BoundField DataField="Pragmatikes" HeaderText="Πραγματικές" 
                SortExpression="Pragmatikes" />
            <asp:BoundField DataField="Balance" HeaderText="Balance" 
                SortExpression="Balance" />
            <asp:BoundField DataField="Year" HeaderText="Έτος" SortExpression="Year" />
            <asp:BoundField DataField="Month" HeaderText="Μήνας" SortExpression="Month" />
        </Columns>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#999999" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
    <br />
    <asp:ListBox ID="ListBox1" runat="server" DataSourceID="sqldsSquadrons" 
        DataTextField="Moira" DataValueField="id_Moira" SelectionMode="Multiple">
    </asp:ListBox>
    <hr />
    <asp:Button ID="Button1" runat="server" Text="Προβολή" />
    <br />

    <asp:SqlDataSource ID="sqldsSquadrons" runat="server" ConnectionString="<%$ ConnectionStrings:_112CW_DBConnectionString %>"
        SelectCommand="SELECT * FROM [KNX_Moires]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="sqldsDueReport" runat="server" ConnectionString="<%$ ConnectionStrings:_112CW_DBConnectionString %>"
        SelectCommand="SELECT  STR_Stratefsimoi.id_Stratefsimos,
        VU_Services.Balance,
        VU_Services.id_Typos,
        VU_Services.Year,
        VU_Services.Month,
        VU_Services.Provlepomenes,
        VU_Services.Pragmatikes,
        VU_Services.id_Provlepomenes,
        AMN_Typos.Typos,
        STR_Stratefsimoi.id_Moira,
        KNX_Moires.Moira,
        STR_Stratefsimoi.Eponimo,
        STR_Stratefsimoi.Onoma
FROM    KNX_Moires
        INNER JOIN STR_Stratefsimoi
        ON KNX_Moires.id_Moira = STR_Stratefsimoi.id_Moira
        LEFT OUTER JOIN AMN_Typos
        INNER JOIN (SELECT  AMN_Provlepomenes.id_Typos,
                            AMN_Provlepomenes.Yphresies AS Provlepomenes,
                            AMN_Provlepomenes.id_Provlepomenes,
                            AMN_Provlepomenes.id_Stratefsimos,
                            COUNT(AMN_Ektelestheises.id_Ektelestheises) AS Pragmatikes,
                            0 AS Balance,
                            YEAR(AMN_Ektelestheises.Hmeromhnia) AS Year,
                            MONTH(AMN_Ektelestheises.Hmeromhnia) AS Month
                    FROM    AMN_Provlepomenes
                            LEFT OUTER JOIN AMN_Ektelestheises
                            ON AMN_Ektelestheises.id_Stratefsimos = AMN_Provlepomenes.id_Stratefsimos
                               AND AMN_Ektelestheises.id_Typos = AMN_Provlepomenes.id_Typos
                    GROUP BY AMN_Provlepomenes.Yphresies,
                            AMN_Provlepomenes.id_Typos,
                            AMN_Provlepomenes.id_Provlepomenes,
                            AMN_Provlepomenes.id_Stratefsimos,
                            YEAR(AMN_Ektelestheises.Hmeromhnia),
                            MONTH(AMN_Ektelestheises.Hmeromhnia)
                   ) AS VU_Services
        ON AMN_Typos.id_Typos = VU_Services.id_Typos
        ON STR_Stratefsimoi.id_Stratefsimos = VU_Services.id_Stratefsimos
WHERE   STR_Stratefsimoi.isDeleted = 0"></asp:SqlDataSource>
        
</asp:Content>

